package com.t12;

/**
 * Created by xuyiwei on 2018/7/23.
 */
class MyException extends Exception{
    public MyException(){};
    public MyException(String msg){super(msg);};
}
public class FullConstructors {
    public static void f() throws MyException {
        System.out.println("Throwing MyException from f()");
        throw new MyException();
    }
    public static void g() throws MyException {
        System.out.println("Throwing MyException from g()");
        throw new MyException("Originated in g()");
    }

    public static void main(String[] args) {
        FullConstructors f = new FullConstructors();
        try {
            FullConstructors.g();
        } catch (MyException e) {
            System.out.println(e.getMessage());
            /**
             * Throwing MyException from g()
             Originated in g()

             */
        }
    }
}
